using System;
using ACS.Runtime.Visitors;

namespace ACS.Runtime.Types
{
    public class BoolType : BaseType
    {
        private bool _val;

        public bool Val
        {
            get { return _val; }
        }

        public BoolType()
        {
        }

        public BoolType(bool val)
        {
            _val = val;
        }

        public static implicit operator BoolType(bool value)
        {
            return new BoolType(value);
        }

        public static implicit operator bool(BoolType value)
        {
            return value.Val;
        }

        public static bool operator ==(BoolType b1, BoolType b2)
        {
            return b1._val == b2._val;
        }

        public static bool operator !=(BoolType b1, BoolType b2)
        {
            return b1._val != b2._val;
        }

        public override int Accept(IVisitor visitor)
        {
            return visitor.Visit(this);
        }

        public override void Assign(BaseType from)
        {
            Assign((BoolType) from);
        }

        public void Assign(BoolType from)
        {
            _val = from._val;
        }
    }
}